package com.java.star.mall.front.pojo.param;

import com.java.star.mall.common.constant.web.PageConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 商品搜索参数
 */
@Data
public class SearchParam implements Serializable {

    private static final long serialVersionUID = 1290807005261416662L;

    @ApiModelProperty(value = "搜索关键字")
    private String keyword;

    @ApiModelProperty(value = "排序规则", notes = "gmt_create：按照时间排序,price：按价格排序")
    @Pattern(regexp = "^(gmt_create|price)$", message = "排序规则值不合法")
    private String sort;

    @ApiModelProperty(value = "排序方式", notes = "asc：正序, desc：倒序")
    @Pattern(regexp = "^(asc|desc)$", message = "排序方式值不合法")
    private String sortType;

    @ApiModelProperty(value = "当前页")
    private Integer page = Integer.parseInt(PageConstant.DEFAULT_PAGE);

    @ApiModelProperty(value = "每页记录数")
    private Integer pageSize = Integer.parseInt(PageConstant.DEFAULT_PAGE_SIZE);
}
